<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  	<!-- 富编辑器加载信息开始 -->
    <script type="text/javascript" charset="utf-8" src="ueditor/ueditor.config.js"></script>
	<script type="text/javascript" charset="utf-8" src="ueditor/ueditor.all.min.js"> </script>
	<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
	<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
	<script type="text/javascript" charset="utf-8" src="ueditor/lang/zh-cn/zh-cn.js"></script>
    <!-- 富编辑器加载信息结束-->
  
  </head>
  
  <body>
  <div style="width:1200px; margin:0 auto;">
  	<div style="width:1200px; height:80px; background-image:url(image/tou.jpg)"></div>
    <div style="height:600px; width:1200px;">
        <div style="width:300px; height:600px; float:left;">
            <div style="background-image:url(image/denglu.jpg); height:60px; text-align: center; font-weight: bold; font-size: 36px;"><div style="height:10px;"></div>
            <a href="index.jsp">登录</a></div>
            <div style="background-image:url(image/zhuce.jpg); height:60px; text-align: center; font-weight: bold; font-size: 36px;"><div style="height:10px;"></div>
            <a href="register.jsp">注册</a></div>
            <div style="background-image:url(image/denglu.jpg); height:60px; text-align: center; font-weight: bold; font-size: 36px;"><div style="height:10px;"></div>
            <a href="list">购物</a></div>
            <div style="background-image:url(image/zhuce.jpg); height:60px; text-align: center; font-weight: bold; font-size: 36px;"><div style="height:10px;"></div>
            <a href="update.jsp">添加商品信息</a></div>
        </div>
        <div style="width:880px; height:600px; float:left; margin-left:20px;">
            <form action="updateproduct">
            	<div style="height:60px; margin-top: 10px; margin-left: 40px;">
            		名称：<input type="text" name="proname"><br>
            		数量：<input type="text" name="pronumber"><br>
            		价格：<input type="text" name="proprice">
            	</div>
	            <!-- 富编辑器开始 -->
			    <div  id="ueditors">
				    	<div style="width:95%; height:483px; margin:0 auto; padding-top: 20px;" id="ueditor" >
								<script id="editor" name="Nic_essay" type="text/plain" style="height:400px;"></script>
						</div>
				</div>
				<input style="float: right; margin-right: 30px;" type="submit" value="上传">
				<!-- 富编辑器结束 -->
			</form>
			<!-- 富编辑器js脚本开始 -->
		    	<script type="text/javascript">
		
		    //实例化编辑器
		    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
		    var ue = UE.getEditor('editor');
		
		
		    function isFocus(e){
		        alert(UE.getEditor('editor').isFocus());
		        UE.dom.domUtils.preventDefault(e)
		    }
		    function setblur(e){
		        UE.getEditor('editor').blur();
		        UE.dom.domUtils.preventDefault(e)
		    }
		    function insertHtml() {
		        var value = prompt('插入html代码', '');
		        UE.getEditor('editor').execCommand('insertHtml', value)
		    }
		    function createEditor() {
		        enableBtn();
		        UE.getEditor('editor');
		    }
		    function getAllHtml() {
		        alert(UE.getEditor('editor').getAllHtml())
		    }
		    function getContent() {
		        var arr = [];
		        arr.push("使用editor.getContent()方法可以获得编辑器的内容");
		        arr.push("内容为：");
		        arr.push(UE.getEditor('editor').getContent());
		        alert(arr.join("\n"));
		    }
		    function getPlainTxt() {
		        var arr = [];
		        arr.push("使用editor.getPlainTxt()方法可以获得编辑器的带格式的纯文本内容");
		        arr.push("内容为：");
		        arr.push(UE.getEditor('editor').getPlainTxt());
		        alert(arr.join('\n'))
		    }
		    function setContent(isAppendTo) {
		        var arr = [];
		        arr.push("使用editor.setContent('欢迎使用ueditor')方法可以设置编辑器的内容");
		        UE.getEditor('editor').setContent('欢迎使用ueditor', isAppendTo);
		        alert(arr.join("\n"));
		    }
		    function setDisabled() {
		        UE.getEditor('editor').setDisabled('fullscreen');
		        disableBtn("enable");
		    }
		
		    function setEnabled() {
		        UE.getEditor('editor').setEnabled();
		        enableBtn();
		    }
		
		    function getText() {
		        //当你点击按钮时编辑区域已经失去了焦点，如果直接用getText将不会得到内容，所以要在选回来，然后取得内容
		        var range = UE.getEditor('editor').selection.getRange();
		        range.select();
		        var txt = UE.getEditor('editor').selection.getText();
		        alert(txt)
		    }
		
		    function getContentTxt() {
		        var arr = [];
		        arr.push("使用editor.getContentTxt()方法可以获得编辑器的纯文本内容");
		        arr.push("编辑器的纯文本内容为：");
		        arr.push(UE.getEditor('editor').getContentTxt());
		        alert(arr.join("\n"));
		    }
		    function hasContent() {
		        var arr = [];
		        arr.push("使用editor.hasContents()方法判断编辑器里是否有内容");
		        arr.push("判断结果为：");
		        arr.push(UE.getEditor('editor').hasContents());
		        alert(arr.join("\n"));
		    }
		    function setFocus() {
		        UE.getEditor('editor').focus();
		    }
		    function deleteEditor() {
		        disableBtn();
		        UE.getEditor('editor').destroy();
		    }
		    function disableBtn(str) {
		        var div = document.getElementById('btns');
		        var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
		        for (var i = 0, btn; btn = btns[i++];) {
		            if (btn.id == str) {
		                UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
		            } else {
		                btn.setAttribute("disabled", "true");
		            }
		        }
		    }
		    function enableBtn() {
		        var div = document.getElementById('btns');
		        var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
		        for (var i = 0, btn; btn = btns[i++];) {
		            UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
		        }
		    }
		
		    function getLocalData () {
		        alert(UE.getEditor('editor').execCommand( "getlocaldata" ));
		    }
		
		    function clearLocalData () {
		        UE.getEditor('editor').execCommand( "clearlocaldata" );
		        alert("已清空草稿箱")
		    }
		</script>
		    <!-- 富编辑器js脚本结束 -->
            
        </div>
    </div>
    <div style="width:1200px; height:80px; background-image:url(image/jiao.jpg)"></div>
  </div>
</body>
</html>
